package cn.rkylin.oms.goodscost.vo;

import java.math.BigDecimal;

import cn.rkylin.oms.goodscost.domain.GoodsCost;

public class GoodsCostVO extends GoodsCost {

    /**
     * 
     */
    private static final long serialVersionUID = 2073356642043706345L;

    /**
     * 按钮定义
     */
    private static final String OPERATION_BTN_UPDATE = "<button onclick=\"updateCost(\'%s\')\" skuId=\"%s\" type=\"button\" class=\"btn btn-info btn-xs\" pepid='updateCost'><i class=\"fa fa-edit\"></i>&nbsp;变更成本</button>";
    private static final String STATUS_ECORDERSHOW = "<span class=\"fadu fa fa-chevron-down\" skuId=\"%s\" goodsId=\"%s\"></span>";
    /**
     * sonShow:显示变更详情
     */
    private String sonShow;

    /**
     * prjId:项目id
     */
    private String prjId;

    /**
     * costPrice：成本价
     */
    private BigDecimal costPrice;

    /**
     * searchCondition:快速查询条件.
     */
    private String quickSearch;

    /**
     * orderBy:排序规则.
     */
    private String orderBy;

    /**
     * operation:操作按钮
     */
    private String operation;

    public String getSonShow() {
        return String.format(STATUS_ECORDERSHOW, this.getSkuId(), this.getGoodsId()).toString();
    }

    public void setSonShow(String sonShow) {
        this.sonShow = sonShow;
    }

    public String getPrjId() {
        return prjId;
    }

    public void setPrjId(String prjId) {
        this.prjId = prjId;
    }

    public BigDecimal getCostPrice() {
        return costPrice;
    }

    public void setCostPrice(BigDecimal costPrice) {
        this.costPrice = costPrice;
    }

    public String getQuickSearch() {
        return quickSearch;
    }

    public void setQuickSearch(String quickSearch) {
        this.quickSearch = quickSearch;
    }

    public String getOperation() {
        StringBuffer opButton = new StringBuffer();
        opButton.append(String.format(OPERATION_BTN_UPDATE, getSkuId(), getSkuId()));
        return opButton.toString();
    }

    public void setOperation(String operation) {
        this.operation = operation;
    }

    public String getOrderBy() {
        return orderBy == null ? null : orderBy.replaceAll(".*([';]+|(--)+).*", " ");// 此字段需要防止sql注入
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

}
